<script>
lang.radio_name = '电台名称'; 
</script>

<style type="text/css">
.divurl { display:block; clear:both; }
.divurl dd { clear:both; }
.divurl dd li { float:left; height:30px; }
</style>

<!--添加友情链接分类-->
<div class="dialog_content">
	<form id="info_form" name="info_form" action="{:u('radio/add')}" method="post">
	<table width="100%" cellpadding="2" cellspacing="1" class="table_form">
		<tr>
			<th width="80">电台名称 :</th>
			<td><input type="text" name="name" id="name" class="input-text" style="width:200px;" /></td>
		</tr>
		<tr>
			<th>所属分类 :</th>
			<td>
				<input type="hidden" name="classid" id="classid" value="" />
				<input type="button" id="sel_btn" class="btn J_selectdialog" value="请选择" data-id="select" 
				data-uri="{:U('radio/select_cate')}" data-title="选择分类" data-param="" data-formid="select_form"  
				data-width="500" data-height="300" data-callback="load_parent" />
				<span id="parent_name" style="color:blue"></span>
				<!-- data-return="true" data-for="" data-sid="" data-fun="" --> 
			</td>
		</tr>
		<tr>
			<th>电台地址 :</th>
			<td>
			<div class="divurl">
				<dl>
					<dd><ul><li><input type="text" name="url1" class="input-text mt5" value="" style="width:300px;" /></li><li><span class="icon_del" title="删除"></span><span class="icon_add" title="增加"></span></li></ul></dd>
				</dl>
				<input type="hidden" name="num" id="num" value="1" />
			</div>
			</td>
		</tr>
		<tr>
			<th>{:L('enabled')} :</th>
			<td>
				<label><input type="radio" name="status" class="radio_style" value="1" checked="checked">&nbsp;{:L('yes')}&nbsp;&nbsp; </label>
				<label><input type="radio" name="status" class="radio_style" value="0">&nbsp;{:L('no')}&nbsp;&nbsp; </label>
			</td>
		</tr>
		<tr>
			<th>是否推荐 :</th>
			<td>
				<label><input type="radio" name="istop" class="radio_style" value="0" checked="checked">&nbsp;不推荐&nbsp;&nbsp; </label>
				<label><input type="radio" name="istop" class="radio_style" value="1">&nbsp;推荐&nbsp;&nbsp; </label>
			</td>
		</tr>
		<tr>
			<th>颜色高亮 :</th>
			<td>
				<label><input type="radio" name="color" class="radio_style" value="#000000" checked="checked">&nbsp;正常&nbsp; </label>
				<label><input type="radio" name="color" class="radio_style" value="#ff0000">&nbsp;<font color='#ff0000'>红色</font>&nbsp; </label>
				<label><input type="radio" name="color" class="radio_style" value="#00bfff">&nbsp;<font color='#00bfff'>天蓝</font>&nbsp; </label>
				<label><input type="radio" name="color" class="radio_style" value="#ff00ff">&nbsp;<font color='#ff00ff'>紫红</font>&nbsp; </label>
				<label><input type="radio" name="color" class="radio_style" value="#7fff00">&nbsp;<font color='#7fff00'>黄绿</font>&nbsp; </label>
				<label><input type="radio" name="color" class="radio_style" value="#ff69b4">&nbsp;<font color='#ff69b4'>粉红</font>&nbsp; </label>
				<label><input type="radio" name="color" class="radio_style" value="#1e90ff">&nbsp;<font color='#1e90ff'>闪兰</font>&nbsp; </label>
				<label><input type="radio" name="color" class="radio_style" value="#ffa500">&nbsp;<font color='#ffa500'>橘色</font>&nbsp; </label>
			</td>
		</tr>
		<tr>
			<th>播放器设置 :</th>
			<td>
				<select name="player">
                <option value="">--默认--</option>
                <option value="1">Media Player</option>
                <option value="2">Real Player</option>
                </select>
			</td>
		</tr>
		<tr>
			<th>电台描述 :</th>
			<td><textarea name="content" style="width:300px; height:50px;"></textarea></td>
		</tr>
	</table>
	</form>
</div>
<script>
function load_parent(a,b) {
	var ids = [];
	var dom = $('input[name="classid"]:checked', a);
	dom.each(function() {
		var val = $(this).val();
		if(val>0) ids.push(val);
	});
	var pid = ids.join(',');
	$('#classid').val(pid);
	$('#sel_btn').attr('data-param','&pid='+pid);
	$('#parent_name').load('{:U("radio/ajax_load_pid")}'+'&pid='+pid);
	b.close(); //关闭窗口
}
var check_name_url = "{:U('radio/ajax_check_name')}";
$(function(){
	$("#name").formValidator({onshow:lang.please_input+lang.radio_name,onfocus:lang.please_input+lang.radio_name}).inputValidator({min:1,onerror:lang.please_input+lang.radio_name}).ajaxValidator({
	    type : "get",
		url : check_name_url,
		datatype : "json",
		async:'false',
		success : function(result){	
            if(result.status == 0){
                return false;
			}else{
                return true;
			}
		},
		onerror : lang.radio_already_exists,
		onwait : lang.connecting_please_wait
	});
});
</script>